﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using MadLibrary.Collections;

namespace MadLibrary.Net.Client
{
    /// <summary>
    /// Holds more enumerable communicators.
    /// </summary>
    public class Communicators : Collection<Communicator>
    {
        /// <summary>
        /// Creates new empty collection of communicators.
        /// </summary>
        public Communicators() : base()
        {

        }
        /// <summary>
        /// Creates new collection of communicators with specified elements.
        /// </summary>
        /// <param name="communicators">Specifies elements for default association to collection.</param>
        public Communicators(params Communicator[] communicators) : base(communicators)
        {

        }
    }
    class CommunicationCollectionEnumerator : IEnumerator
    {
        private int position = -1;
        private Communicators Requests { get; set; }
        public CommunicationCollectionEnumerator(Communicators collection)
        {
            this.Requests = collection;
        }
        object IEnumerator.Current
        {
            get { return Requests[position]; }
        }

        bool IEnumerator.MoveNext()
        {
            if (position < Requests.Count - 1)
            {
                position++;
                return true;
            }
            else
                return false;
        }

        void IEnumerator.Reset()
        {
            this.position = -1;
        }
    }
}
